
<!DOCTYPE >
<html>

<head>

    <title>NIPT检测</title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="icon" href="favicon.ico" />
    <link href="../css/bootstrap.min.css" rel="stylesheet" />
    <link href="../css/font-awesome.min.css" rel="stylesheet" />
    <link href="../css/default.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery.min.js"></script>
    <!--[if lt IE 9]>
    <script src="js/bootstrap/html5shiv.min.js"></script>
    <script src="js/bootstrap/respond.min.js"></script>
    <![endif]-->
    <!--页面加载进度条-->
    <link href="../css/pace/dataurl.css" rel="stylesheet" />
    <script src="../js/pace/pace.min.js"  type="text/javascript"></script>
    <script src="../js/jquery.scrolltopcontrol/scrolltopcontrol.js" type="text/javascript"></script>
    <script src="../js/jquery.extend.js" type="text/javascript"></script>
    <script src="../js/default.js" type="text/javascript"></script>

    <link rel="stylesheet" type="text/css" href="easyui/themes/ui-cupertino/easyui.css" />
    <link rel="stylesheet" type="text/css" href="easyui/themes/icon.css" />
    <link rel="stylesheet" type="text/css" href="css/icon.css" />
    <link rel="stylesheet" type="text/css" href="css/uims.css" />
    <link rel="stylesheet" type="text/css" href="css/temp.css" />

    <script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js"></script>

    <script src="../js/bootstrap/bootstrap.min.js"></script>
    <script src="../js/bootstrap/bootstrap-table.min.js"></script>
    <script src="../js/bootstrap/bootstrap-table-zh-CN.min.js"></script>

    <script type="text/javascript" src="js/dataGridCellTip.js"></script>
    <script type="text/javascript" src="js/validate.js"></script>
    <script type="text/javascript" src="js/json2.js"></script>

    <script type="text/javascript" src="js/sampleCommon.js"></script>
    <script type="text/javascript" src="js/template.js"></script>
    <script type="text/javascript" src="js/deaf.js"></script>

    <!-- artTemplate 模板引擎 -->
    <script src="../js/template-web.js" type="text/javascript"></script>

    <!-- 设置送检单位 -->
    <script src="../js/set-customer.js" type="text/javascript"></script>

    <style>
        .coupon-box {
            height: 120px;
            text-align: center;
            line-height: 120px;
            border: 1px dashed #2e85b8;
            font-size: 24px;
            color: #cecece;
            margin: 30px 0 10px 0;
            cursor: pointer;
            background: #fff;
        }

        .coupon-item {
            width: 80%;
            box-shadow: 2px 2px 5px #f2f2f2, -2px -2px 5px #f2f2f2;
            border-bottom: 1px solid #eee;
            display: flex;
            margin: 10px auto;
            flex-direction: row;
        }

        .coupon-item .btn {
            display: block;
            margin: 10px;
            width: 60px;
            padding: 0;
            height: 28px;
            line-height: 28px;
            text-align: center;
            background: #45b4f5;
            color: #fff;
            /* outline: none; */
            border-color: transparent;
        }

        .coupon-item .content-wrapper {
            flex: 1;
            padding: 10px;
            line-height: 24px;
        }

        .coupon-item .content-wrapper .name {
            font-size: 14px;
            font-weight: 400;
            color: rgba(0, 0, 0, 0.85);
        }

        .coupon-item .content-wrapper .desc {
            font-size: 12px;
            margin-top: 4px;
            color: rgba(0, 0, 0, 0.55);
        }

        .search-box input {
            display: inline-block;
            flex: 1;
            height: 33px;
            line-height: 33px;
            padding-left: 6px;
            /* border-color: transparent; */
            outline: none;
            box-shadow: none;
            /* border: 0; */
            border: 1px solid #7bcdf8;
        }

        .search-box button {
            width: 80px;
            background: #7bcdf8;
            outline: none;
            border: 1px solid #7bcdf8;
            color: #fff;
        }

        .empty-coupon {
            text-align: center;
            line-height: 42px;
            height: 42px;
            font-size: 18px;
            color: rgba(0, 0, 0, 0.45);
        }

        .no-coupon {
            height: 33px;
            line-height: 33px;
            text-align: center;
            margin: 10px 0;
            border: 1px dashed #7bcdf8;
            cursor: pointer;
        }
    </style>
</head>

<body>
<!--我是主要内容-->
<div class="container" style="height: 1000px">
	<div class="content">
		<div class="coupon-box" onclick="chooseCoupon()">
			选择免费券
		</div>
		<table class="second-table t-group">
			<thead></thead>
			<tbody>
			<tr class="blue-tr">
				<td class="droppable t-group-title">关键信息</td>
			</tr>
			<tr>
				<td class="droppable">
									<span class="field t-group-item">
										<span class="required">*</span>
										<i class="t-field-id" data-value="customerCode"></i>
										<i class="t-type" data-value="text"></i>
										<i class="t-name t-require">送检单位</i>：
										<select value="" class="addressCounty" onchange="onAddressCountyChange(this.value)"></select>
										<input id="customerCode" style="width:168px;" class="easyui-combobox" data-options="valueField:'customerCode',textField:'customerName'">
									</span>
				</td>
			</tr>
			<tr>
				<td class="droppable column3">
                                     <span class="field t-group-item">
										<i class="t-field-id" data-value="sampleName"></i>
										<i class="t-type" data-value="text"></i>
										<i class="t-name">科室</i>：
										<input type="text" id="departments"  >
									</span>

					<span class="field t-group-item">
										<span class="required">*</span>
										<i class="t-field-id" data-value="bloodDate"></i>
										<i class="t-name t-require">采样日期</i>：
										<input type="date" id="bloodDate" validate="required" min="1990-01-01" max="2999-05-20" style="width: 170px;" class="t-value">
									</span>
				</td>
			</tr>
			<tr>
				<td class="droppable column3">
									<span class="field t-group-item">
										<span class="required">*</span>
										<i class="t-field-id" data-value="sampleName"></i>
										<i class="t-type" data-value="text"></i>
										<i class="t-name t-require">姓名</i>：
										<input type="text" id="sampleName" validate="required">
									</span>
					<span class="field t-group-item">
										<span class="required">*</span>
										<i class="t-type" data-value="split"></i>
										<i class="t-field-id" data-value="gestationalWeeks"></i>
										<i class="t-name t-require">孕周</i>：
										<span class="t-group-item-split">
											<i class="t-field-id" data-value="gestationalWeeks1"></i>
											<i class="t-hint" data-value=""></i>
											<i class="t-type" data-value="number"></i>
											<i class="t-name t-require" style="display: none;">孕周</i>
											<input type="text" id="gestationalWeeks1" validate="required" style="width: 80px;">
										</span>
										<span class="t-group-item-split">
											<i class="t-hint" data-value=""></i>
											<i class="t-type" data-value="number"></i>
											<i class="t-field-id" data-value="gestationalWeeks2"></i>
											<i class="t-name t-require">W+</i>
											<input type="text" id="gestationalWeeks2" validate="required" style="width: 80px;">
										</span>
									</span>
				</td>
			</tr>
			<tr>
				<td class="droppable column3">
									<span class="field t-group-item">
										<span class="required">*</span>
										<i class="t-field-id" data-value="idCard"></i>
										<i class="t-type" data-value="idCard"></i>
										<i class="t-name t-require">身份证/护照</i>：
										<input type="text" id="idCard" validate="required,idCard" onblur="idCardBlur()" class="t-value" style="width: 155px;">
									</span>
					<span class="field t-group-item">
										<span class="required">*</span>
										<i class="t-field-id" data-value="motherPhoneNum"></i>
										<i class="t-type" data-value="phoneNum"></i>
										<i class="t-name t-require">联系电话</i>：
										<input type="text" id="motherPhoneNum" validate="required,phoneNum" class="t-value">
									</span>
					<span class="field t-group-item">
										<i class="t-field-id" data-value="husbandPhoneNum"></i>
										<i class="t-type" data-value="phoneNum"></i>
										<i class="t-name">丈夫电话</i>：
										<input type="text" id="husbandPhoneNum" validate="phoneNum">
									</span>
				</td>
			</tr>
			</tbody>
		</table>
		<table class="second-table t-group">
			<tr class="blue-tr">
				<td class="droppable t-group-title">基本情况</td>
			</tr>
			<tr>
				<td class="droppable column3">
					<span class="field t-group-item">
						<span class="required">*</span>
						<i class="t-field-id" data-value="motherAge"></i>
						<i class="t-type" data-value="number"></i>
						<i class="t-name t-require">年龄</i>：
						<input type="text" id="motherAge" validate="required" style="width: 150px;" class="t-value">
					</span>
				</td>
			</tr>
			<tr>
				<td class="droppable column3">
								<span class="field" style="text-align: left;">
									<span class="t-group-item">
										<span class="required">*</span>
										<i class="t-field-id" data-value="bodyWeight"></i>
										<i class="t-type" data-value="text"></i>
										<i class="t-name">体重</i>：
										<input type="text" id="bodyWeight" validate="required" style="width: 50px;">
										<i class="t-unit">公斤</i>
									</span>
									<span class="t-group-item"> &nbsp;
										<span class="required">*</span>
										<i class="t-field-id" data-value="bodyHeight"></i>
										<i class="t-name">身高</i>：
										<i class="t-type" data-value="text"></i>
										<input type="text" id="bodyHeight" validate="required" style="width: 50px;">
										<i class="t-unit">厘米</i>
									</span>
								</span>
					<span class="field t-group-item"> &nbsp;
										<span class="required">*</span>
									<i class="t-field-id" data-value="lmp"></i>
									<i class="t-name">末次月经</i>：
									<input type="date" id="lmp" min="1990-01-01" validate="required" max="2999-05-20" class="t-value">
								</span>
				</td>
			</tr>
			<tr>
				<td class="droppable column3">
								<span class="field t-group-item" style="text-align: left">
									<i class="t-field-id" data-value="clinicalDiagnosis"></i>
									<i class="t-name">临床诊断</i>：
									<input type="text" id="clinicalDiagnosis" style="width: 183px;" class="t-value">
								</span>
					<span class="field t-group-item">
									<i class="t-field-id" data-value="doctorName"></i>
									<i class="t-name">医生姓名</i>：
									<input type="text" id="doctorName" class="t-value">
								</span>
				</td>
			</tr>
			<tr>
				<td class="droppable">
								<span class="field t-group-item">
									<i class="t-field-id" data-value="sampleRecipientEmail"></i>
									<i class="t-type" data-value="email"></i>
									<i class="t-name">通讯地址（或电子邮箱）</i>：
									<input type="text" id="sampleRecipientEmail" style="width: 600px;">
								</span>
				</td>
			</tr>
			<tr>
				<td class="droppable column2">
								<span class="group-field field t-group-item" validate="required">
									<span class="required">*</span>
									<i class="t-field-id" data-value="pregnancy"></i>
									<i class="t-name">本次妊娠方式</i>：
									<input name="xx0.9218910641346394" id="pregnancy_0" type="checkbox" class="t-value" data-name="自然受孕" data-value="0">自然受孕
									<input name="xx0.9218910641346394" id="pregnancy_1" type="checkbox" class="t-value" data-name="促排卵" data-value="1">促排卵
									<input name="xx0.9218910641346394" id="pregnancy_2" type="checkbox" class="t-value" data-name="宫内人工受精" data-value="2">宫内人工受精
								</span>
					<span class="group-field field t-group-item" style="text-align: left;" validate="required">
									<span class="required">*</span>
									<i class="t-field-id" data-value="adosculation"></i>
									<i class="t-name t-require">是否IVF</i>：
									<input name="xx0.44586902149771435" id="adosculation_0" type="checkbox" class="t-value" data-name="否" data-value="0">否
									<input name="xx0.44586902149771435" id="adosculation_1" type="checkbox" class="t-value" data-name="是" data-value="1">是
								</span>
				</td>
			</tr>
		</table>
		<table class="second-table t-group">
			<tr class="blue-tr">
				<td class="droppable t-group-title">既往病史</td>
			</tr>
			<tr>
				<td class="droppable">
								<span class="field t-group-item">
                                	<span class="required">*</span>
									<i class="t-field-id" data-value="personalReproductiveHistory"></i>
									<i class="t-name">生育史</i>：
									<i class="t-field-id" data-value="personalReproductiveHistory"></i>
									<i class="t-type" data-value="split"></i>
									<i class="t-unit"></i>
									<span class="t-group-item-split">
										<i class="t-field-id" data-value="personalReproductiveHistory1"></i>
										<i class="t-hint" data-value=""></i>
										<i class="t-type" data-value="text"></i>
										<i class="t-name">孕</i>
										<input type="text" validate="int,required" id="personalReproductiveHistory1" style="width: 45px;">
										<i class="t-unit">次</i>
									</span>
									<span class="t-group-item-split">
										<i class="t-field-id" data-value="personalReproductiveHistory2"></i>
										<i class="t-hint" data-value=""></i>
										<i class="t-type" data-value="text"></i>
										<i class="t-name">产</i>
										<input type="text" validate="int,required" id="personalReproductiveHistory2" style="width: 45px;">
										<i class="t-unit">次</i>,
									</span>
								</span>
								<span class="field t-group-item">
									<i class="t-field-id" data-value="familyProduce"></i>
									<i class="t-name">家族史</i>：
									<input type="text" id="familyProduce" style="width: 346px;" class="t-value">
								</span>
				</td>
			</tr>
			<tr>
				<td class="droppable">
								<span class="group-field field t-group-item" validate="required">
                                	<span class="required">*</span>
									<i class="t-field-id" data-value="abnormalPregnancyHistory"></i>
									<i class="t-name">不良孕产史</i>：
									<input name="xx0.6405569958060631" id="abnormalPregnancyHistory_0" type="checkbox" class="t-value" data-name="无" data-value="0">无
									<input name="xx0.6405569958060631" id="abnormalPregnancyHistory_1" type="checkbox" class="t-value" data-name="有" data-value="1">有
								</span>
					<span class="field t-group-item">&nbsp;&nbsp;
						<span class="required">*</span>
						<i class="t-field-id" data-value="naturalAbortionNum"></i>
						<i class="t-type" data-value="number"></i>
						<i class="t-name t-require">自然流产次数</i>：
						<input type="text" id="naturalAbortionNum" validate="required" style="width: 33px;">
						<i class="t-unit" style="display: none;">次</i>
					</span>
					<span>次</span>
					<span class="field t-group-item">&nbsp;&nbsp;
                                	<span class="required">*</span>
									<i class="t-field-id" data-value="stillbirthNum"></i>
									<i class="t-type" data-value="number"></i>
									<i class="t-name">死胎病史</i>：
									<input type="text" id="stillbirthNum" validate="required" style="width: 30.8px;">
									<span>&nbsp;&nbsp;</span>
									<i class="t-unit" style="display: none;">次</i>
								</span>
					<span>次</span>
				</td>
			</tr>
			<tr>
				<td class="droppable">
                            <span class="group-field field t-group-item" validate="required">
                                <input class="submit" id="oaf-input" type="hidden" value="" />
                                <span class="required">*</span>
									<i class="t-field-id" data-value="ckTestOther"></i>
									<i class="t-name">畸形儿孕产史</i>：
									<input name="xx0.03065537021515552" id="oaf_0" type="checkbox" class="t-value" data-name="否" data-value="0" onclick="getChoice(this)">否
									<input name="xx0.03065537021515552" id="oaf_1" type="checkbox" class="t-value" data-name="13三体" data-value="0" onclick="getChoice(this)">13三体
								    <input name="xx0.03065537021515552" id="oaf_2" type="checkbox" class="t-value" data-name="18三体" data-value="1" onclick="getChoice(this)">18三体
                                   <input name="xx0.03065537021515552" id="oaf_3" type="checkbox" class="t-value" data-name="21三体" data-value="2" onclick="getChoice(this)">21三体
                                <input name="xx0.03065537021515552" id="oaf_4" type="checkbox" class="t-value" data-name="神经管缺陷" data-value="3" onclick="getChoice(this)">神经管缺陷
                                <input name="xx0.03065537021515552" id="oaf_5" type="checkbox" class="t-value" data-name="其他" data-value="4" onclick="getChoice(this)">其他
								</span>
				</td>
			</tr>

			<tr>
				<td class="droppable column2">
								<span class="group-field field t-group-item" validate="required">
                                	<span class="required">*</span>
									<i class="t-field-id" data-value="gravidaKaryotype"></i>
									<i class="t-name">孕妇染色体核型</i>：
									<input name="xx0.17762032921738125" id="gravidaKaryotype_0" type="checkbox" class="t-value" data-name="未做" data-value="0">未做
									<input name="xx0.17762032921738125" id="gravidaKaryotype_1" type="checkbox" class="t-value" data-name="正常" data-value="1">正常
									<input name="xx0.17762032921738125" id="gravidaKaryotype_2" type="checkbox" class="t-value" data-name="异常" data-value="2">异常
								</span>
					<span class="group-field field t-group-item" validate="required">
                                	<span class="required">*</span>
									<i class="t-field-id" data-value="husbandKaryotype"></i>
									<i class="t-name">丈夫染色体核型</i>：
									<input name="xx0.5398099047701526" id="husbandKaryotype_0" type="checkbox" class="t-value" data-name="未做" data-value="0">未做
									<input name="xx0.5398099047701526" id="husbandKaryotype_1" type="checkbox" class="t-value" data-name="正常" data-value="1">正常
									<input name="xx0.5398099047701526" id="husbandKaryotype_2" type="checkbox" class="t-value" data-name="异常" data-value="2">异常
								</span>
				</td>
			</tr>
			<tr>
				<td class="droppable column2">
								<span class="group-field field t-group-item" validate="required">
									既往史:
									<span class="required">*</span>
									<i class="t-field-id" data-value="allogeneticTransfusion"></i>
									<i class="t-name t-require">一年内异体输血</i>：
									<input name="xx0.7844767959731702" id="allogeneticTransfusion_0" checked="checked" type="checkbox" class="t-value" data-name="无"
										   data-value="0">无
									<input name="xx0.7844767959731702" id="allogeneticTransfusion_1" type="checkbox" class="t-value" data-name="有（不接受）" data-value="1">有（不接受）
								</span>
					<span class="group-field field t-group-item" validate="required">
									<span class="required">*</span>
									<i class="t-field-id" data-value="cellularImmunity"></i>
									<i class="t-name t-require">四周内异体细胞免疫</i>：
									<input name="xx0.13005703123732992" id="cellularImmunity_0" checked="checked" type="checkbox" class="t-value" data-name="无"
										   data-value="0">无
									<input name="xx0.13005703123732992" id="cellularImmunity_1" type="checkbox" class="t-value" data-name="有（不接受）" data-value="1">有（不接受）
								</span>
				</td>
			</tr>
			<tr>
				<td class="droppable column2">
								<span class="group-field field t-group-item" validate="required">
									<span class="required" style="margin-left: 49px;">*</span>
									<i class="t-field-id" data-value="surgicalTransplantation"></i>
									<i class="t-name t-require">移植手术</i>：
									<input name="xx0.3803408671393358" id="surgicalTransplantation_0" checked="checked" type="checkbox" class="t-value" data-name="无"
										   data-value="0">无
									<input name="xx0.3803408671393358" id="surgicalTransplantation_1" type="checkbox" class="t-value" data-name="有（不接受）" data-value="1">有（不接受）
								</span>
					<span class="group-field field t-group-item" validate="required">
									<span class="required">*</span>
									<i class="t-field-id" data-value="stemCell"></i>
									<i class="t-name t-require">干细胞治疗</i>：
									<input name="xx0.13527403573847807" id="stemCell_0" checked="checked" type="checkbox" class="t-value" data-name="无" data-value="0">无
									<input name="xx0.13527403573847807" id="stemCell_1" type="checkbox" class="t-value" data-name="有（不接受）" data-value="1">有（不接受）
								</span>
				</td>
			</tr>

			</tbody>
		</table>
		<table class="second-table t-group">
			<tr class="blue-tr">
				<td class="droppable t-group-title">辅助检查</td>
			</tr>

			<tr>
				<td class="droppable">
                              <span class="group-field field t-group-item">
                                  <input class="submit" id="btypeAbnormal-input" type="hidden" value="" />
									<i class="t-field-id" data-value="btypeAbnormal"></i>
									<i class="t-name">B超异常</i>：
									<input name="xx0.8078310630244527" id="btypeAbnormal_0" type="checkbox" class="t-value" data-name="无" data-value="0" onclick="getChoice(this)">无
									<input name="xx0.8078310630244527" id="btypeAbnormal_1" type="checkbox" class="t-value" data-name="有" data-value="1" onclick="getChoice(this)">有
                                  &nbsp;<input type="text" id="btypeAbnormalDesc" style="width: 150px;" class="t-value">
								</span>
					<span>&nbsp;&nbsp;</span>
					<span class="group-field field t-group-item"  validate="required">
									<span class="required">*</span>
                                    <input class="submit" id="btypeUltrasonic-input" type="hidden" value="" />
									<i class="t-field-id" data-value="btypeUltrasonic"></i>
									<i class="t-name">胎数</i>：
									<input name="xx0.8078310630244527" id="btypeUltrasonic_0" type="checkbox" class="t-value" data-name="单胎" data-value="0" onclick="getChoice(this)">单胎
									<input name="xx0.8078310630244527" id="btypeUltrasonic_1" type="checkbox" class="t-value" data-name="双胎" data-value="1" onclick="getChoice(this)">双胎
                                    <input name="xx0.8078310630244527" id="btypeUltrasonic_2" type="checkbox" class="t-value" data-name="多胎" data-value="2" onclick="getChoice(this)">多胎（多胎妊娠不适合进行无创产前基因检测）

								</span>
				</td>
			</tr>
		</table>
		<table class="second-table t-group">
			<tr class="blue-tr">
				<td class="droppable t-group-title">产品信息</td>
			</tr>
			<tr>
				<td class="droppable">
								<span class="field t-group-item-product">
									<input id="product_DX0558" type="checkbox" disabled="disabled">
									<b>
										<span id="productName_DX0558" class="t-product-name">胎儿染色体非整倍体（T21、T18、T13）检测（联合探针锚定连接测序法）</span>
									</b>（
									<i class="t-product-value">DX0558</i>）
								</span>
				</td>
			</tr>
		</table>
	</div>
    <div style="width:220px; margin: 30px auto;">
        <button onclick="save();" style="width: 120px; height: 33px; border-radius: 2px; border-radius: 4px; background: rgb(23,134,184); color: #fff; outline: none; border-color: transparent;">保存</button>
    </div>
</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    免费券列表
                </h4>
            </div>
            <div class="modal-body">
                <div class="search-box" style='display:flex;flex-direction:row'>
                    <input type="text" placeholder="请输入证件号码" id="coupon-kw" style="display:inline-block;flex:1">
                    <button onclick="searchCoupons()">搜索</button>
                </div>
                <div class="no-coupon">
                    不使用免费券
                </div>
                <div class="empty-coupon">
                    没有免费券
                </div>
                <div class="coupon-list">
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">
                    关闭
                </button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal -->
</div>

<a href="#top" id="goTop">
    <i class="fa fa-angle-up fa-3x"></i>
</a>
<script type="text/javascript">
    //计算年龄
    function getAge(idCardNum){

        var birthYear= parseInt(idCardNum.substr(6,4));
        var dateObj=new Date();
        var currentYear= parseInt(dateObj.getFullYear());
        var currentAge=currentYear-birthYear;
        $("#motherAge").val(currentAge) ;
    }
	//输完身份证带出年龄
	function idCardBlur() {
		getAge($("#idCard").val());
	}
    //获取畸形儿类，B超异常，胎数信息
    function getChoice(obj){
        var typeId=obj.id;
        var typeValue = $("#"+obj.id).data("value");
        var typeName = typeId.substr(0,typeId.indexOf("_"));
        $("#"+typeName+"-input").val(typeValue);
    }

    //不使用优惠券
    $(".no-coupon").click(function () {
        $("#dnaMotherIdCard").removeAttr('disabled');
        $("#sampleName").removeAttr('disabled');
        $('#myModal').modal('hide');
        couponNum = '';
        $('.coupon-box').html('选择免费券');
    });

    //退出登录
    function logout() {
        $.ajax({
            url: '/csfy/dologout.do',
            method: 'POST',
            success: function (res) {
                if (JSON.parse(res).code == 200) {
                    window.location.href = "/csfy/index.do"
                }
            }
        })
    }
    //使用优惠券
    var couponNum = '';

    //受检者姓名
    var sampleName = '';

    function useCoupon(num) {
        //优惠券对应的身份证号码
        var id = $("#coupon-kw").val();
        //设置优惠券对应的身份证
        $("#idCard").val(id);
        //设置身份证输入框不可编辑
        $("#idCard").attr('disabled', 'disabled');
		//带出年龄
		getAge(id);
        //使用优惠券姓名
        $("#sampleName").val(sampleName);
        $("#sampleName").attr('disabled', 'disabled');

        $('#myModal').modal('hide');
        $('.coupon-box').html('免费券码：' + (num ? num : ''));

        //重置搜索列表
        $("#coupon-kw").val('');
        $(".coupon-list").html('');
        $(".empty-coupon").hide();

        couponNum = num;
    }
    //TODO 根据证件搜索优惠券
    function searchCoupons() {
        var id = $("#coupon-kw").val();
        if (id) {
            $.ajax({
                method: 'POST',
                url: '/csfy/intf.do',
                data: {
                    method: 'getDetailPresonInfo',
                    id
                },
                success: function (res) {
                    console.log(res)
                    var couponList = '';
                    sampleName = res.rows.name;
                    $(".coupon-list").html('');
                    $(".empty-coupon").html('正在搜索...');
                    if (res && res.code == 200) {
                        var couponInfos = (res.rows && res.rows.couponInfos) || [];
                        if (couponInfos.length > 0) {
                            var mData = {};
                            mData.rows = couponInfos;
                            var html = template('coupon-list', mData);
                            $(".coupon-list").html(html);
                            $(".empty-coupon").hide();
                        } else {
                            $(".empty-coupon").html('未找到当前证件名下的免费券');
                        }
                    } else {
                        $(".empty-coupon").html('未找到当前证件名下的免费券');
                    }
                }
            });
        } else {
            $(".coupon-list").html('');
            $(".empty-coupon").show();
            $(".empty-coupon").html('没有找到免费券');
        }
    }
    $("#product_DX0558")[0].checked = true;
    //选择使用优惠券
    function chooseCoupon() {
        $('#myModal').modal('show');
    }
    function save(cover) {
        //获取当前页面的子页面里面的属性值
        var msg = temp.validate();
        //获取模板字段。
        var obj = temp.saveAbs();
        //报错并退出
        if (msg) {
            sysErrorShow(msg);
            return false;
        }

        //数据过滤 start
        var params = {};
        Object.keys(obj).map(key => {
            var prototype = Object.prototype.toString.call(obj[key]);
        if ('[object String]' === prototype && obj[key]) {
            params[key] = obj[key];
        }
    });
        params.productName = 'NIPT检测';
        params.productCode = 'DX0558';
        if (couponNum) {
            params.couponNum = couponNum;
        }

        //传递畸形儿类型数据
        if($("#oaf-input").val() !=""){
            params.ckTestOther = $("#oaf-input").val();
        }

        //传递B超异常数据
        var btypeAbnormalIn=$("#btypeAbnormal-input").val();
        if(btypeAbnormalIn !=""){
            params.btypeAbnormal = btypeAbnormalIn;
            if(btypeAbnormalIn == "1"){
                var btypeDesc= $("#btypeAbnormalDesc").val();
                if(btypeDesc !=""){
                    params.btypeAbnormalDesc = btypeDesc;
                }else{
                    alert("请输入B超异常信息！");
                    return false;
                }

            }
        }

        //传递胎数数据
        if($("#btypeUltrasonic-input").val()!=""){
            params.btypeUltrasonic=$("#btypeUltrasonic-input").val();
        }

        //设置模板文件路径，对应前端工作平台1.0的模板服务器路径
        params.fileVer = "temp/Nifty.jsp";

        //数据过滤 end
        //console.log(JSON.stringify(params));
        $.ajax({
                    type: 'POST',
                    data: {
                        method: isEdit ? 'updateSampleBaseBySampleBaseId' : 'createSampleBase',
                            ...params,
                    sampleBaseId: isEdit ? sampleBaseId : undefined
                },
                url: '/csfy/intf.do',
                error: function (e) {
            sysErrorShow('操作失败!');
        },
        success: function (res) {
            if (res && res.code == 200) {
                alert(isEdit ? "修改送检单成功" : "保存送检单成功");
                if (!isEdit)
                    window.location.href = window.location.pathname;
                else
                    sessionStorage.setItem("sampleEditSuccess", "true");
            } else if (res) {
                alert(res.msg ? res.msg : "操作失败")
            }
        }
    });
    }
    //获取当前登录用户信息
    $(document).ready(function () {
        $.ajax({
                    method: 'POST',
                    url: '/csfy/intf.do',
                    data: { method: 'getLoginUserInfo' },
                    success: res => {
                    if (res.code == 10086) {
        <!--window.location.href = "/csfy/index.do"-->
                    alert("请重新登录！");
        } else {
            if (res.code == 200) {
                $(".username").html(res.rows.userName);
            }
        }
    }
    })
    })
</script>
<!-- 优惠券列表渲染 -->
<script id="coupon-list" type="text/html">
    {{each rows item i}}
    <div class="coupon-item">
        <div class="content-wrapper">
            <div class="name">{{item.couponName}}</div>
            <div class="desc">{{item.couponDesc}}</div>
        </div>
        {{if item.productCode == 'DX0558' && item.status == '1'}}
        <button class="btn btn-primary" onclick="useCoupon('{{item.couponNum}}')">使用</button>
        {{/if}}
        {{if item.productCode != 'DX0558' || (item.productCode == 'DX0558' && item.status != '1')}}
        <button class="btn btn-disbled" disabled>不可用</button>
        {{/if}}
    </div>
    {{/each}}
</script>
</body>
<style type="text/css">
    .second-table tr td input[type~="text"],
    select,
    input[type~="date"] {
        width: 160px;
    }

    .select-discribe {
        color: rgb(0, 192, 255);
    }

    .column3 .field {
        display: inline-block;
        min-width: 250px;
        text-align: left;
    }

    .column2 .field {
        width: 50%;
        float: left;
    }
</style>

</html>